<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- 修改表单 -->
	<div id="updateDiv">
		<form class="layui-form" action="" lay-filter="updateForm">
			<div class="layui-form-item">
				<label class="layui-form-label">公司地址</label>
				<div class="layui-input-inline">
					<input type="text" name="homeIntro" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">Id</label>
				<div class="layui-input-inline">
					<input type="text" name="id" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off"
						class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">电话</label>
				<div class="layui-input-inline">
					<input type="text" name="zsTel" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">手机</label>
				<div class="layui-input-inline">
					<input type="text" name="tel" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">公司信息</label>
				<div class="layui-input-inline">
					<div id="div1" style="width: 700px"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-inline">
					<input type="text" name="adress" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">横坐标</label>
				<div class="layui-input-inline">
					<input type="text" name="x" required lay-verify="required"
						placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">纵坐标</label>
				<div class="layui-input-inline">
					<input type="text" name="y" id="imag2" required
						lay-verify="required" placeholder="请输入" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo2">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="js/wangEditor.min.js"></script>
	<script>
		layui.use([ 'table', 'form', 'layer' ], function() {
			var table = layui.table;
			var form = layui.form;
			var layer = layui.layer;
			var $ = layui.$;

			var E = window.wangEditor
			var editor = new E('#div1')
			editor.create()
			$.post("GongsiAdmin?method=getList5", function(res) {
				if (res.code == 0) {
					form.val("updateForm", res.data);
					editor.txt.html(res.data.info)
				}
			}, "json")
			form.on('submit(formDemo2)', function(data) {
				data.field.info = editor.txt.html();

				console.log(data.field);

				$.post("GongsiAdmin?method=updategs", data.field,
						function(res) {
							console.log(res);
							if (res.code == 0) {
								layer.msg(res.msg, {
									time : 1000
								}, function() {
									layer.closeAll(); //关闭所有窗口
									table.reload('idTest', {}); //表格重载（需要id指明哪一个表格）
								})
							}
						}, "json")

				return false;
			});

		});//结束
	</script>
</body>
</html>